﻿<UserControl 
    x:Class="DiscoveryLogic.Analytics.Modules.Searches.QuickSearch"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:Controls="clr-namespace:Microsoft.Windows.Controls;assembly=WPFToolkit"
    Height="Auto" Width="Auto" MaxWidth="600"
    Background="Transparent" Loaded="UserControl_Loaded">
    <Border CornerRadius="10" BorderBrush="Gray">
        <Grid Margin="5" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
            <Grid.RowDefinitions>
                <RowDefinition Height="30"/>
                <RowDefinition Height="30"/>
                <RowDefinition Height="*"/>
                <RowDefinition Height="30"/>
                <RowDefinition Height="30"/>
                <RowDefinition Height="30"/>
                <RowDefinition Height="30"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="140"/>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            
            <Label HorizontalAlignment="Left"
                Grid.Row="0" Grid.Column="0" Margin="5,0,0,0"
                VerticalAlignment="Center">Area:</Label>
            <ComboBox x:Name="cboEntity" HorizontalAlignment="Left"
                Grid.Row="0" Grid.Column="1" Margin="5,0,5,0" MinWidth="150"
                VerticalAlignment="Center" SelectionChanged="cboEntity_SelectionChanged"></ComboBox>
            <TextBox x:Name="txtSearch"
                Grid.Row="0" Grid.Column="2" Margin="5,0,5,0"
                VerticalAlignment="Center"></TextBox>
            
            <Label
                Grid.Row="1" Grid.Column="0" Margin="5,0,0,0" HorizontalAlignment="Left"
                VerticalAlignment="Center">Field:</Label>
            <ComboBox 
                x:Name="cboField" Grid.Row="1" Grid.Column="1"
                MinWidth="150" VerticalAlignment="Center" Margin="5,0,5,0" 
                HorizontalAlignment="Left"></ComboBox>
            <Button x:Name="btnSearch" Grid.Row="1" Grid.Column="2"
                    Margin="5,0,0,0" HorizontalAlignment="Left"
                    VerticalAlignment="Center" Width="55" Click="btnSearch_Click">Search</Button>
            
            <Label
                Grid.Row="2" Grid.Column="0" Margin="5,0,0,0"
                VerticalAlignment="Top" HorizontalAlignment="Left">Result:</Label>
            <ScrollViewer 
                HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto"
                Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="2"
                MaxHeight="300">
                <Controls:DataGrid 
                    x:Name="dgSearchResult"
                    VerticalAlignment="Stretch" Margin="5,5,5,5"
                    HorizontalAlignment="Stretch" MinHeight="100"
                    AutoGenerateColumns="True">
                </Controls:DataGrid>
            </ScrollViewer>
            
            <RadioButton 
                x:Name="rdNewNetwork"
                Grid.Row="3" Grid.Column="0" Margin="5,0,0,0" IsChecked="True"
                VerticalAlignment="Center" Checked="rdNewNetwork_Checked">New network:</RadioButton>
            <TextBox 
                x:Name="txtNewNetwork" Grid.Row="3" Grid.Column="1" 
                Margin="5,0,5,0" VerticalAlignment="Center" HorizontalAlignment="Left" MinWidth="150"/>
            <CheckBox 
                Grid.Row="3" Grid.Column="2" VerticalAlignment="Center"
                Margin="5,0,0,0"
                x:Name="ckAddSelected" Content="Add selected records"></CheckBox>
            
            <RadioButton x:Name="rdCurrentNetwork"
                Grid.Row="4" Grid.Column="0" Margin="5,0,5,0" IsChecked="False"
                VerticalAlignment="Center" Checked="rdCurrentNetwork_Checked">Existing network:</RadioButton>
            <ComboBox x:Name="cboExistingNetworks" Grid.Row="4" Grid.Column="1"
                      VerticalAlignment="Center" Margin="5,0,5,0"></ComboBox>
            <Label Grid.Row="5" Grid.Column="0" Margin="5,0,5,0"
                   VerticalAlignment="Center">Link rule:</Label>
            <ComboBox x:Name="cboLinkRules" Grid.Row="5" Grid.Column="1"
                      VerticalAlignment="Center" Margin="5,0,5,0"></ComboBox>
            <Button Grid.Row="5" Grid.Column="2" 
                    VerticalAlignment="Center" HorizontalAlignment="Left"
                    x:Name="btnAddToCurrentGraph" Content="Add to network"
                    Margin="5,0,0,0" Width="120" Click="btnAddToCurrentGraph_Click" />

            <StackPanel
                Grid.Row="6" Grid.Column="0" Grid.ColumnSpan="3"
                Margin="5,0,5,0" VerticalAlignment="Center"
                HorizontalAlignment="Right" Orientation="Horizontal">
                <Button
                    x:Name="btnClose" Margin="5,0,0,0" Width="50" Content="Close" Click="btnClose_Click" />
            </StackPanel>
        </Grid>
    </Border>
</UserControl>
